package foreachdemo;

import java.util.ArrayList;
import java.util.HashMap;

/**
 * Created with IntelliJ IDEA
 * Description
 * User：chenshu
 * Date：2023-11-09
 * Time：11:38
 */
public class Demo {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        list.add("aaa");
        list.add("bbb");
        list.add("ccc");
        list.forEach((s) -> System.out.println(s));

        HashMap<Integer, String> map = new HashMap();
        map.put(1,"hello");
        map.put(2,"world");
        map.put(3,"hello");
        map.put(4,"lambda");
        map.forEach((key,val) -> System.out.println("key:" + key + "," + "value:" + val));
    }

}
